#include "stdafx.h"
#include "NanoSecTimer.h"

MicroSecTimer::MicroSecTimer(void)
{
	LARGE_INTEGER litmp; 
	QueryPerformanceFrequency(&litmp);
	dfFreq = static_cast<double>(litmp.QuadPart);
	QueryPerformanceCounter(&t0);
}

MicroSecTimer::~MicroSecTimer(void)
{
}

void MicroSecTimer::setTimer()
{
	QueryPerformanceCounter(&timer);
}

double MicroSecTimer::stopTimer()
{
	LARGE_INTEGER litmp; 
	QueryPerformanceCounter(&litmp);
	return 1000*(double)(litmp.QuadPart-timer.QuadPart)/(double)dfFreq;
}

double MicroSecTimer::getTime()
{
	LARGE_INTEGER litmp; 
	QueryPerformanceCounter(&litmp);
	return 1000*(double)(litmp.QuadPart-t0.QuadPart)/(double)dfFreq;
}

